Only handle key bindings for tab reordering if the tabs are shown and
authorMatthias Clasen <mclasen@redhat.com>
Tue, 2 Jan 2007 06:22:37 +0000 (06:22 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 2 Jan 2007 06:22:37 +0000 (06:22 +0000)
2007-01-01  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtknotebook.h:
        * gtk/gtknotebook.c: Only handle key bindings for
        tab reordering if the tabs are shown and reorderable.
        (#390468, Yevgen Muntyan)

        * gtk/gtkmarshalers.list: Add required marshaler

svn path=/trunk/; revision=17008

ChangeLog
gtk/gtkmarshalers.list
gtk/gtknotebook.c
gtk/gtknotebook.h

index 163957c869150c1c3c803ceac16cb861417a5313..3d63313f4b1a0c9fd04aa59d226bd3b971d207cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-01-01  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtknotebook.h:
+       * gtk/gtknotebook.c: Only handle key bindings for
+       tab reordering if the tabs are shown and reorderable. 
+       (#390468, Yevgen Muntyan)
+
+       * gtk/gtkmarshalers.list: Add required marshaler
+
 2007-01-01  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkcontainer.c (gtk_container_class_list_child_properties):
index c1510ec2fe0b635d01952a0e7686eb543f994c6c..175c14949748d392185715e0947813983390a94a 100644 (file)
@@ -24,6 +24,7 @@
 BOOLEAN:BOXED
 BOOLEAN:BOXED,BOXED
 BOOLEAN:ENUM
+BOOLEAN:ENUM,BOOLEAN
 BOOLEAN:ENUM,DOUBLE
 BOOLEAN:ENUM,INT
 BOOLEAN:OBJECT
index 9f8d14ed00a744845dd22b60f37c84738b533909..c5f0e41859f6b6a3c45afe54e4e83cd86e30bc34 100644 (file)
@@ -201,11 +201,11 @@ static gboolean gtk_notebook_select_page         (GtkNotebook      *notebook,
                                                  gboolean          move_focus);
 static gboolean gtk_notebook_focus_tab           (GtkNotebook      *notebook,
                                                  GtkNotebookTab    type);
-static void     gtk_notebook_change_current_page (GtkNotebook      *notebook,
+static gboolean gtk_notebook_change_current_page (GtkNotebook      *notebook,
                                                  gint              offset);
 static void     gtk_notebook_move_focus_out      (GtkNotebook      *notebook,
                                                  GtkDirectionType  direction_type);
-static void     gtk_notebook_reorder_tab         (GtkNotebook      *notebook,
+static gboolean gtk_notebook_reorder_tab         (GtkNotebook      *notebook,
                                                  GtkDirectionType  direction_type,
                                                  gboolean          move_to_last);
 
@@ -815,8 +815,8 @@ gtk_notebook_class_init (GtkNotebookClass *class)
                   G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                   G_STRUCT_OFFSET (GtkNotebookClass, change_current_page),
                   NULL, NULL,
-                  _gtk_marshal_VOID__INT,
-                  G_TYPE_NONE, 1,
+                  _gtk_marshal_BOOLEAN__INT,
+                  G_TYPE_BOOLEAN, 1,
                   G_TYPE_INT);
   notebook_signals[MOVE_FOCUS_OUT] =
     g_signal_new (I_("move_focus_out"),
@@ -833,8 +833,8 @@ gtk_notebook_class_init (GtkNotebookClass *class)
                   G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                   G_STRUCT_OFFSET (GtkNotebookClass, reorder_tab),
                   NULL, NULL,
-                  _gtk_marshal_VOID__ENUM_BOOLEAN,
-                  G_TYPE_NONE, 2,
+                  _gtk_marshal_BOOLEAN__ENUM_BOOLEAN,
+                  G_TYPE_BOOLEAN, 2,
                   GTK_TYPE_DIRECTION_TYPE,
                  G_TYPE_BOOLEAN);
   /**
@@ -1026,7 +1026,7 @@ static gboolean
 gtk_notebook_select_page (GtkNotebook *notebook,
                           gboolean     move_focus)
 {
-  if (gtk_widget_is_focus (GTK_WIDGET (notebook)))
+  if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && notebook->show_tabs)
     {
       gtk_notebook_page_select (notebook, move_focus);
       return TRUE;
@@ -1041,7 +1041,7 @@ gtk_notebook_focus_tab (GtkNotebook       *notebook,
 {
   GList *list;
 
-  if (gtk_widget_is_focus (GTK_WIDGET (notebook)))
+  if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && notebook->show_tabs)
     {
       switch (type)
        {
@@ -1063,12 +1063,15 @@ gtk_notebook_focus_tab (GtkNotebook       *notebook,
     return FALSE;
 }
 
-static void
+static gboolean
 gtk_notebook_change_current_page (GtkNotebook *notebook,
                                  gint         offset)
 {
   GList *current = NULL;
 
+  if (!notebook->show_tabs)
+    return FALSE;
+
   if (notebook->cur_page)
     current = g_list_find (notebook->children, notebook->cur_page);
 
@@ -1101,6 +1104,8 @@ gtk_notebook_change_current_page (GtkNotebook *notebook,
     gtk_notebook_switch_page (notebook, current->data, -1);
   else
     gtk_widget_error_bell (GTK_WIDGET (notebook));
+
+  return TRUE;
 }
 
 static GtkDirectionType
@@ -1248,7 +1253,7 @@ reorder_tab (GtkNotebook *notebook, GList *position, GList *tab)
   return g_list_position (notebook->children, tab);
 }
 
-static void
+static gboolean
 gtk_notebook_reorder_tab (GtkNotebook      *notebook,
                          GtkDirectionType  direction_type,
                          gboolean          move_to_last)
@@ -1258,16 +1263,16 @@ gtk_notebook_reorder_tab (GtkNotebook      *notebook,
   GList *last, *child;
   gint page_num;
 
-  if (!gtk_widget_is_focus (GTK_WIDGET (notebook)))
-    return;
+  if (!gtk_widget_is_focus (GTK_WIDGET (notebook)) || !notebook->show_tabs)
+    return FALSE;
 
   if (!notebook->cur_page ||
       !notebook->cur_page->reorderable)
-    return;
+    return FALSE;
 
   if (effective_direction != GTK_DIR_LEFT &&
       effective_direction != GTK_DIR_RIGHT)
-    return;
+    return FALSE;
 
   if (move_to_last)
     {
@@ -1290,7 +1295,7 @@ gtk_notebook_reorder_tab (GtkNotebook      *notebook,
                                      TRUE);
 
   if (!child || child->data == notebook->cur_page)
-    return;
+    return FALSE;
 
   page = child->data;
 
@@ -1308,7 +1313,11 @@ gtk_notebook_reorder_tab (GtkNotebook      *notebook,
                     0,
                     ((GtkNotebookPage *) notebook->focus_tab->data)->child,
                     page_num);
+
+      return TRUE;
     }
+
+  return FALSE;
 }
 
 /**
index 3c9c45eeb9a3823a26886e3bd9c51900ac38d2d0..55db1708c2ba3b23d52bf614b2be14467a80b2b1 100644 (file)
@@ -101,11 +101,11 @@ struct _GtkNotebookClass
                                 gboolean           move_focus);
   gboolean (* focus_tab)       (GtkNotebook       *notebook,
                                 GtkNotebookTab     type);
-  void (* change_current_page) (GtkNotebook       *notebook,
+  gboolean (* change_current_page) (GtkNotebook   *notebook,
                                 gint               offset);
   void (* move_focus_out)      (GtkNotebook       *notebook,
                                GtkDirectionType   direction);
-  void (* reorder_tab)         (GtkNotebook       *notebook,
+  gboolean (* reorder_tab)     (GtkNotebook       *notebook,
                                GtkDirectionType   direction,
                                gboolean           move_to_last);